package vip.xiaonuo.modular.business.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import vip.xiaonuo.modular.business.entity.BiUserIndexType.BiUserIndexType;
import vip.xiaonuo.modular.business.mapper.BiUserIndexTypeMapper;
import vip.xiaonuo.modular.business.service.BiUserIndexTypeService;

import java.util.List;

/**
 * (BiUserIndexType)表服务实现类
 *
 * @author makejava
 * @since 2022-08-03 14:34:51
 */
@Service("biUserIndexTypeService")
public class BiUserIndexTypeServiceImpl extends ServiceImpl<BiUserIndexTypeMapper, BiUserIndexType> implements BiUserIndexTypeService {


    @Override
    public List<BiUserIndexType> list(Long userId) {
        LambdaQueryWrapper<BiUserIndexType> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(BiUserIndexType::getUserId,userId);
        wrapper.select(BiUserIndexType::getId,BiUserIndexType::getUserId,BiUserIndexType::getIndexTypeId);
        return this.list(wrapper);
    }

    @Override
    public void removeByUserId(Long userId) {
        LambdaUpdateWrapper<BiUserIndexType> wrapper = new LambdaUpdateWrapper();
        wrapper.eq(BiUserIndexType::getUserId,userId);
        this.remove(wrapper);
    }


}

